package com.hula.loan4u.activity;


import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.hula.loan4u.utils.UmengUtil;
import com.zhy.http.okhttp.OkHttpUtils;

import butterknife.ButterKnife;


public abstract class BaseActivity extends FragmentActivity {
    protected Context mContext;
    protected String TAG;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = this;
        TAG = getLocalClassName();
        setContentView(getContentViewResId());
        ButterKnife.bind(this);
        initView();
        initData(savedInstanceState);
        setListener();
    }

    @Override
    protected void onResume() {
        super.onResume();
        UmengUtil.onResume(this);
    }

    @Override
    protected void onPause() {
        super.onPause();
        UmengUtil.onPause(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        OkHttpUtils.getInstance().cancelTag(mContext);
    }

    protected abstract int getContentViewResId();

    protected abstract void initView();

    protected abstract void initData(Bundle savedInstanceState);

    protected abstract void setListener();
}
